package kr.hkit.powerjava.chapter24.work3;

class Subject{
	private int kor;
	private int eng;
	private int math;
	
	public Subject(int kor, int eng, int math) {
		this.kor = kor;
		this.eng = eng;
		this.math = math;
	}

	public int getKor() {
		return kor;
	}

	public void setKor(int kor) {
		this.kor = kor;
	}

	public int getEng() {
		return eng;
	}

	public void setEng(int eng) {
		this.eng = eng;
	}

	public int getMath() {
		return math;
	}

	public void setMath(int math) {
		this.math = math;
	}
	
}

public class Student implements Comparable<Student>{

	private int stdNum;
	private String stdName;
	private Subject sub;

	public Student(int stdNum, String stdName) {
		this.stdNum = stdNum;
		this.stdName = stdName;
	}

	public Student(int stdNum, String stdName, Subject sub) {
		this.stdNum = stdNum;
		this.stdName = stdName;
		this.sub = sub;
	}



	public int getStdNum() {
		return stdNum;
	}

	public void setStdNum(int stdNum) {
		this.stdNum = stdNum;
	}

	public String getStdName() {
		return stdName;
	}

	public void setStdName(String stdName) {
		this.stdName = stdName;
	}

	public Subject getSub() {
		return sub;
	}

	public void setSub(Subject sub) {
		this.sub = sub;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Student) {
			return stdName.equals(((Student) obj).stdName)
					&& stdNum == ((Student) obj).stdNum;
		}
		return false;
	}

	@Override
	public int compareTo(Student o) {
		return stdNum - o.stdNum;
	}

}
